package com.example.doctor.jpa;

import java.util.List;

import com.example.common.entity.OrderMain;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

/**
 * @author sifan
 * @PackagName:com.example.doctor.jpa
 * @ClassName: OrderMainRepository
 * @Description:
 * @date:2021/1/21 13:47
 */
public interface OrderMainRepository extends JpaRepository<OrderMain,String> {

    @Query(value = "SELECT * FROM order_main WHERE pid_bigint =:pid  AND a_type_int =10 AND oc_status_tinyint !=0 AND system_status_tinyint=2 ORDER BY create_time_datetime DESC LIMIT 1",nativeQuery = true)
    OrderMain queryOrederMainByPid(@Param("pid") Long pid);

    @Query(value = "SELECT * FROM order_main WHERE order_no_nvarchar in (:OrderNOs)",nativeQuery = true)
    List<OrderMain> queryOrderByIds(@Param("OrderNOs") List<String> OrderNOs);
}
